﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AssetFrame.BP;
using AssetFrame.Message;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using SysFrame.BP;
using SysFrame.Message;

namespace AppServer.Controllers.Asset
{
    [Route("api/[controller]")]
    [ApiController]
    public class SysAssetA2Controller : SysControllerBase
    {
        // 角色可见字段配置
        // POST: api/SysAssetA2
        [HttpPost]
        public ActionResult<string> Post([FromBody] dynamic data)
        {
            string jsTimeStamp = data.jsTimeStamp;
            string Action = data.Action == null ? "Get" : data.Action;
            string rtstr = "";
            //得到列表
            if (Action == "Get")
            {
                rtstr = Get(data);
            }
            //if (Action == "Save")
            //{
            //    rtstr = Save(data);
            //}
            return rtstr;
        }

        /// <summary>
        /// 得到选择的值
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public string Get(dynamic data)
        {
            JObject postdata = JObject.FromObject(data.data);
            string str10 = postdata["str10"].ToString();
            List<Mssys_asset_a2> listms = new BLLsys_asset_a2().Getsys_asset_a2MsByQuery(new MsQuery(" and SYS_ASSET_A2_10='" + str10 + "'"));
            List<string> liststr20 = listms.ConvertAll(m => m.SYS_ASSET_A2_20.ToString());
            return JArray.FromObject(liststr20).ToString();
        }
    }
}